home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!news
- From: solution@gate.net (Ken Walter)
- Newsgroups: comp.std.c++
- Subject: Initialization of Static Components of a Template Class
- Date: 08 Jan 1996 23:05:11 GMT
- Organization: Solution Technology
- Approved: austern@mti.sgi.com
- Message-ID: <4cr2m1$1kcq@news.gate.net>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Newsreader: NeoLogic News for OS/2 [version: 4.2]
-
-
-
- If I have a template class such as:
-
- template<class T> SOMEclass
- {
- ..
- private:
- static int AStatic;
- }
-
-
- I would like to also be able to say in the header file:
-
- template<class T> int SOMEclass::AStatic(0);
-
- and have it automaticaly expanded by the compiler with the template class.
-
- Requiring the users of the template class to initialize ever class instance
- is very inconvenient! It almost forces one to use a macro:
-
- #define SOMEclassSTATICS( T ) int SOMEclass<T>::AStatic(0); /
- // other initialization of SOMEclass statics
-
- Or am I missing somrthing from the latest language definition?
-
- Ken Walter
-
- * All the above is hearsay and the opinion of nobody in particular
-
-
-
-